package com.wolf.etl.core.task;

import com.wolf.etl.core.ETLManager;
import com.wolf.vo.BaseResult;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * @author sdyang
 * @date 2019/11/5 10:36
 **/
@Service("scheduleQuartzJob")
@DisallowConcurrentExecution //作业不并发
public class ScheduleQuartzJob implements Job {

    private static Logger logger = LoggerFactory.getLogger(ScheduleQuartzJob.class);


    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        String group = context.getJobDetail().getJobDataMap().get("group").toString();
        String name = context.getJobDetail().getJobDataMap().get("name").toString();
        Long task_id = Long.parseLong(context.getJobDetail().getJobDataMap().get("task_id").toString());
        ETLManager manager = (ETLManager) context.getJobDetail().getJobDataMap().get("manager");

        BaseResult result = manager.execute(task_id);

    }
}
